package com.city.repository.report;

import com.city.domain.report.CtTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface CtTaskRepository extends JpaRepository<CtTask,Integer>{


    //更新完成时间
    @Transactional
    @Modifying
    @Query(value = "update ct_task set work_time=?1 where task_id=?2",nativeQuery = true)
    void updateWorkTime(String workTime,Integer taskId);

    //更新审核时间
    @Transactional
    @Modifying
    @Query(value = "update ct_task set check_time=?1 where task_id=?2",nativeQuery = true)
    void updateCheckTime(String checkTime,Integer taskId);

    //通过任务Id查询
    @Query(value = "SELECT * from ct_task where task_id = ?1",nativeQuery = true)
    CtTask findByTaskId(Integer id);

    //更新结案时间
    @Transactional
    @Modifying
    @Query(value = "update ct_task set finish_time=?1 where task_id=?2",nativeQuery = true)
    void updateFinishTime(String finishTime,Integer taskId);

    //更新返工评论
    @Transactional
    @Modifying
    @Query(value = "update ct_task set rework_comment=?1 where task_id=?2",nativeQuery = true)
    void updateReworkComment(String comment,Integer taskId);

    //更新回撤理由
    @Transactional
    @Modifying
    @Query(value = "update ct_task set caseback_comment=?1 where task_id=?2",nativeQuery = true)
    void updateCaseComment(String comment,Integer taskId);
}
